package com.qf.springbootdemo01.controller;

import com.qf.springbootdemo01.pojo.Dog;
import com.qf.springbootdemo01.pojo.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author q
 * @version V1.0
 * @date 2021/11/19
 **/
@RestController
public class QuickController {

    @Value("${person.dog.name}")
    private String dogName;

    @Autowired
    private Dog dog;

    @Autowired
    private Person person;

    @GetMapping("/quick")
    public String quick(){
        return "Hello SpringBoot ~";
    }

    @GetMapping("/test01")
    public String test01(){
        dog.setName("erha");
        dog.setAge(3);
        System.out.println(dog);
        //Dog(name=erha, age=3)
        System.out.println(person);
        //Person(name=tom, age=18, boss=false, birth=Mon May 20 00:00:00 CST 2002,
        //  maps={k1=v1, k2=v2}, lists=null, dog=Dog(name=keji, age=3))
        return dogName;
    }

}
